    <!-- 头部 -->
    <%- include('header', { title: "修改班级" }); -%>
    <!-- /头部 -->
    <!-- 主体内容 -->
    <div class="content">
        <!-- 侧边栏 -->
        <%- include('menu', { active: "class" }); -%>
        <!-- 侧边栏 -->
        <div class="main">
            <form class="form-container">
                <div class="form-group">
                    <input type="hidden" class="form-control" value="<%= data.id %>" id="id">
                </div>
                <div class="form-group">
                    <label>班级名称</label>
                    <input type="text" class="form-control" placeholder="班级名称" value="<%= data.className %>"
                        id="classname">
                </div>
                <div class="buttons">
                    <button type="button" class="btn btn-primary" onclick="submitAjax()">提交</button>
                </div>
            </form>
        </div>
    </div>
    <!-- /主体内容 -->
    <%- include('footer'); -%>
    <script>
        function submitAjax() {
            // 取得用户输入的值
            let id = $("#id").val()
            let className = $("#classname").val()
            // console.log(className);
            if(!className){
                return toastr.error('班级名不能为空')
            } else {
                $.ajax({
                    type: "PUT",
                    url: "http://localhost:3000/class",
                    data: {
                        // 修改的数据在数组里面的索引号
                        id: id,
                        className: className
                    },
                    success: function(res){
                        if(!res.err){
                            // 页面跳转
                            return location.href = "http://localhost:3000/class"
                        }
                        toastr.error(res.msg)
                    },
                    error: function(){
                        toastr.error('修改班级失败')
                    }
                })
            }
        }
    </script>
    </body>

    </html>